﻿
@{
    ViewBag.Title = "账号激活";
}


<div class="mesg red" style="font-size:30px;color:cyan;
font-weight:800;margin:150px auto;text-align:center;">正在激活账号...</div>
@section scripts{
    <script>
        $(function () {
            $.ajax({
                url: '/uc/a/activeuser',
                type: 'post',
                data: {
                    key: $.queryString("key")
                },
                success(data) {
                    if (data.IsSuccess) {
                        $('.mesg').html('激活成功!<strong id="timer" style="color:aliceblue;">5</strong>秒后跳转到<a href="/">首页</a>');
                        startTimer();
                    } else {
                        $('.mesg').html(`激活失败!${data.Message}`);
                    }
                }
            });
        });
        var startTimer = function () {
            var timer,
                countDown = function () {
                var time = $('#timer').text();
                if (time == 1) {
                    clearInterval(timer);
                    window.location.href = '/';
                } else {
                    $('#timer').text(time - 1);
                }
            }
            timer = setInterval(countDown, 1000);
        }

    </script>
}


